package com.etennis.util;

import com.etennis.security.LoginClubDetails;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;

public class SecurityUtils {
    public static LoginClubDetails getLoginClub()
    {
        return (LoginClubDetails) getAuthentication().getPrincipal();
    }
    public static Authentication getAuthentication() {
        return SecurityContextHolder.getContext().getAuthentication();
    }

    public static Long getLoginClubId(){
        return getLoginClub().getClub().getId();
    }


}